var list = document.querySelector('.main-list')

var xhr = new XMLHttpRequest()
xhr.open('get','http://47.116.75.38:8101/web/about/us/agencyInfo')
xhr.send(null)
xhr.onload = function () {
  var res = JSON.parse(xhr.response)
  console.log(res)
  res.data.records.forEach(function (item) {
    var div = document.createElement('div')
    div.className = 'tit-zb'

    var h3 = document.createElement('h3')
    h3.innerText = item.agencyName

    var div1 = document.createElement('div')
    div1.className = 'zb-i'

    var img = document.createElement('img')
    img.src = 'image/zxdz-1.jpg'

    var div2 = document.createElement('div')
    var a = document.createElement('a')
    a.innerText = '查看中心地图'
    var a1 = document.createElement('a')
    a1.innerText = '查看中心环境'

    div2.appendChild(a)
    div2.appendChild(a1)
    div2.className = 'zb-i-r'

    div1.appendChild(img)
    div1.appendChild(div2)

    var ul = document.createElement('ul')

    var li = document.createElement('li')
    var i = document.createElement('i')
    i.className = 'iconfont icon-duihuaxinxitianchong'
    li.appendChild(i)
    var span = document.createElement('span')
    span.innerText = '校区编号：'+item.campusCode
    li.appendChild(span)

    var li1 = document.createElement('li')
    var i1 = document.createElement('i')
    i1.className = 'iconfont icon-wxbdingwei'
    li1.appendChild(i1)
    var span1 = document.createElement('span')
    span1.innerText = item.addr
    li1.appendChild(span1)

    var li2 = document.createElement('li')
    var i2 = document.createElement('i')
    i2.className = 'iconfont icon-dianhua '
    li2.appendChild(i2)
    var span2 = document.createElement('span')
    span2.innerText = '电话：'+item.telephone
    li2.appendChild(span2)


    ul.appendChild(li)
    ul.appendChild(li1)
    ul.appendChild(li2)

    div.appendChild(h3)
    div.appendChild(div1)
    div.appendChild(ul)

    list.appendChild(div)
  })
}
